//////////////////////////////////////////////////////////////////////////////////////////////
//	File			:	"CreditsState.cpp"
//
//	Author			:	Mike Davis, Matt Stover, James Thornton, Keith Webster
//	
//	Project			:	TacWars
//
//	Last Modified	:	11/6/2013
//
//	Purpose			:	
//
//////////////////////////////////////////////////////////////////////////////////////////////
#include "CreditsState.h"
#include "../../SGD Wrappers/CSGD_Direct3D.h"
#include "../../SGD Wrappers/CSGD_DirectInput.h"
#include "../../SGD Wrappers/CSGD_TextureManager.h"
#include "../../SGD Wrappers/CSGD_XAudio2.h"
#include "../../SGD Wrappers/CSGD_MessageSystem.h"
#include "../../SGD Wrappers/CSGD_EventSystem.h"
#include "../../SGD Wrappers/SGD_String.h"
#include "../../SGD Wrappers/SGD_Math.h"
#include "../Game.h"
#include <cassert>

CreditsState* CreditsState::GetInstance()
{
	static CreditsState Instance;

	return &Instance;
}
CreditsState::CreditsState()
{
	cursor = 0;
}
CreditsState::~CreditsState()
{
}
/*virtual*/ void CreditsState::Enter()
{
	titleImgID = CSGD_TextureManager::GetInstance()->LoadTexture(_T("resource/Images/MapStage3.png"));
}
/*virtual*/ void CreditsState::Exit()
{

}
/*virtual*/ bool CreditsState::Input()
{
	CSGD_DirectInput* DI = CSGD_DirectInput::GetInstance();

	if(DI->JoystickIsUnplugged())
	{
		if(DI->KeyPressed(DIK_RETURN) == true || DI->KeyPressed(DIK_ESCAPE) == true)
		{
			Game::GetInstance()->PopState();

		}
	}
	else
	{
		if(DI->JoystickButtonPressed(1) == true || DI->JoystickButtonPressed(0) == true)
		{
			Game::GetInstance()->PopState();
		}
	}
	return true;
}
/*virtual*/ void CreditsState::Update( float fElapsedTime )
{

}
/*virtual*/ void CreditsState::Render()
{
	BitmapFont* Font = Game::GetInstance()->GetFont();
	CSGD_TextureManager::GetInstance()->Draw(titleImgID, 0, 0, 1.0f, 1.0f);

	Font->Draw( _T("CREDITS"), 
		(int)((640 - (4*32*2.0f)) / 2), 
		25, 2.0f, D3DCOLOR_ARGB(255, 255, 255, 255) );

	Font->Draw( _T("CREATED BY"), (400 - (4*32)) / 2, 150, .75f, D3DCOLOR_ARGB(255, 255, 255, 255) );
	Font->Draw( _T("MIKE DAVIS\t\tMATTHEW STOVER\n\nJAMES THORNTON\tKEITH WEBSTER"), (200 - (4*32)) / 2, 200, .75f, D3DCOLOR_ARGB(255,255,255,255));
	Font->Draw( _T("ASSOCIATE PRODUCER"), (400 - (4*32)) / 2, 300, .75f, D3DCOLOR_ARGB(255,255,255,255));
	Font->Draw( _T("ROBERT MARTINEZ"), (300 - (4*32)) / 2, 350, .75f, D3DCOLOR_ARGB(255,255,255,255));
	//DO IT
	Font->Draw( _T("COURSE DIRECTOR"), (400 - (4*32)) / 2, 400, .75f, D3DCOLOR_ARGB(255,255,255,255));
	Font->Draw( _T("JOHN OLESKI"), (300 - (4*32)) / 2, 450, .75f, D3DCOLOR_ARGB(255,255,255,255));

	Font->Draw( _T("ARTIST"), (1100 - (4*32)) / 2, 400, .75f, D3DCOLOR_ARGB(255,255,255,255));
	Font->Draw( _T("MAHER SAGRILLO"), (1100 - (4*32)) / 2, 450, .75f, D3DCOLOR_ARGB(255,255,255,255));





	Font->Draw(_T("OK"), (500-(4*32)) / 2, 600, 1.0f, D3DCOLOR_ARGB(255,255,255,255));
	Font->Draw( _T("(     )"), (500 - (7*32)) / 2, 700, 1.0f, D3DCOLOR_ARGB(255, 255, 255, 255) );

}
